#ifndef PROJECTZ_NUSER_NCOMMAND_CS_SELECT_TRAINING_TIME_H_
#define PROJECTZ_NUSER_NCOMMAND_CS_SELECT_TRAINING_TIME_H_

#include "../../engine.h"

#include "../../User.h"

#include <math.h>

//#include "../../NLogic/Level.h"

namespace ProjectZ { namespace NCommand { namespace NWorld {

static int GetDrillValue(int drill_time)
{
	switch(drill_time)
	{
	case 1:		return 50;
	case 5:		return 200;
	case 10:	return 300;
	}

	return 0;
}

class CS_SELECT_TRAINING_TIME
{
public:
	static void OnExecute(User * pUser, ::Network::Packet * pPacket)
	{
		PREPARE_PACKET;
		//Player_Info & player_info = pUser->player_info;

		int drill_time = 0;
		pPacket->ParseMsg("%c", &drill_time);

		int exp = pUser->GetCharacterInfo().level * pow((drill_time + 5),2)/4*10;
		int gold = pow(pUser->GetCharacterInfo().level,2) * drill_time * GetDrillValue(drill_time);


		::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
		pAck->Write4(exp);
		pAck->Write4(gold);
		pAck->MakePacket(CMD_SC_SELECT_TRAINING_TIME);

		pUser->Send(pAck);
	}
};

} /*NWorld*/ } /*NCommand*/ } /*ProjectZ*/


#endif /* PROJECTZ_NUSER_NCOMMAND_CS_SELECT_TRAINING_TIME_H_ */
